home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Sample Code / Catalog Service Access Module / DTS Sample CSAM / Src / MPWCallCompletion.a < prev    next >
Encoding:
Text File  |  1993-06-24  |  1.9 KB  |  64 lines  |  [TEXT/MPS ]

  1. *
  2. * MPWCallCompletion.a
  3. * Copyright © 1992, Apple Computer Inc., All Rights Reserved.
  4. *
  5. * This function is called by the driver when the request
  6. * completes. If the user has defined a completion routine,
  7. * it restores A5 and calls the user's routine as if it
  8. * were defined as
  9. *        void
  10. *        UserCompletion(
  11. *                ParmBlockPtr    pb
  12. *        );
  13. * For convenience, the ioResult code is in D0, and the condition
  14. * codes are set on the ioResult.
  15. *
  16. * This file is compiled by MPW and linked with the actual driver C
  17. * source files. It is not used when the driver is compiled by Think C.
  18. *
  19. * Author:        Martin Minow
  20. *                Apple Computer Inc.
  21. *                Cupertino, CA, USA
  22. * InterNet:        minow@apple.com
  23. * AppleLink:    MINOW
  24. *
  25.             print        push,off            ; Don't waste paper
  26.             include        'SysEqu.a'
  27.             include        'DriverGlue.incl.a'    ; MacsBug name macro
  28.             print        pop
  29.             case        obj
  30.  
  31. *
  32. * DirParamHeader is defined in OCEAuthDir.h
  33. *
  34. DirParamHeader    record    0    ;    struct DirParamBlock {
  35. qLink            ds.l    1    ;        Ptr        qLink;
  36. reserved_H1        ds.l    1    ;        long    reserved_H1;
  37. reserved_H2        ds.l    1    ;        long    reserved_H2;
  38. ioCompletion    ds.l    1    ;        ProcPtr    ioCompletion;
  39. ioResult        ds.w    1    ;        OSErr    ioResult;
  40. saveA5            ds.l    1    ;        long    saveA5;
  41. reqCode            ds.w    1    ;        short    reqCode;
  42.                 endr        ;    };
  43.  
  44. CallCompletion    proc        export
  45.                 with        DirParamHeader
  46.                 move.l        4(sp),a0            ; a0 -> parameter block
  47.                 move.w        ioResult(a0),d0        ; d0 == ioResult
  48.                 move.l        ioCompletion(a0),d1    ; Get user completion, if any
  49.                 beq.s        @1                    ; Exit if none
  50.                 move.l        a5,-(sp)            ; Save current A5
  51.                 move.l        saveA5(a0),a5        ; Restore user A5
  52.                 link        a6,#0                ; Establish a stack frame context
  53.                 move.l        a0,-(sp)            ; Push call parameter
  54.                 move.l        d1,a1                ; Locate the function
  55.                 tst.w        d0                    ; Set condition codes
  56.                 jsr            (a1)                ; Call user completion
  57.                 unlk        a6                    ; Clean out the stack
  58.                 move.l        (sp)+,a5            ; Restore current A5
  59. @1                rts                                ; Exit from CallCompletion
  60.                 endwith
  61.                 DbgInfo        CallCompletion
  62.                 endp
  63.                 end
  64.